package cd.safe.school.adapter;

import java.util.List;
import java.util.Map;

import cd.safe.school.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SchoolMienAdapter extends BaseAdapter {
	private Context context;
	private List<Map<String, Object>> lists;

	public SchoolMienAdapter(Context context, List<Map<String, Object>> lists) {
		this.context = context;
		this.lists = lists;

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return lists.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			LayoutInflater in = LayoutInflater.from(context);
			convertView = in.inflate(R.layout.schoolmien_item, null);
		}
		TextView school_title = (TextView) convertView
				.findViewById(R.id.school_title);
		TextView school_instroduce = (TextView) convertView
				.findViewById(R.id.school_instrouce);
		school_title.setText((CharSequence) lists.get(position).get(
				"school_title"));
		school_instroduce.setText((CharSequence) lists.get(position).get(
				"school_instroduce"));

		return convertView;
	}

}
